package com.example.service.impl;


import com.example.mapper.UserMapper;
import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//实现类实现接口方法
@Service
public class UserServiceimpl implements UserService {

    @Autowired
    //注入依赖
    private UserMapper userMapper;


    @Override
    public List<User> list() {
        return userMapper.list();
    }

    @Override
    public void delete(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public void add(User user) {
        user.setStatus(0);
        user.setTel("temp");
        userMapper.add(user);
    }

    @Override
    public User login(User user) {
        User u =null;
        u = userMapper.getByUsernameAndPassword(user);
        return u;
    }
}
